﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;

namespace University.Workshop.DataAccess
{
    
    [Serializable()]
    public class User
    {
        public Collection<int> Decks { get; private set; }
        
        public string Name { get; set; }
        public string Password { get; set; }
        public string Email { get; set; }
        public string Answer { get; set; }
        public int Question { get; set; }
        public int Status { get; set; }
        public long Chips { get; set; }
        public string Loan { get; set; } 
       // public BitmapImage image;
//        public byte[] Picture { get; set; }
        public int Size { get; set; }
        public int UserLevel { get; set; }
        public long TimeWon { get; set; }
        public int DeckUserPresent { get; set; }

        public long LogOn { get; set; }
        private int indexInt {get; set; }
        private string indexString { get; set; }
        public User()
        {
            Decks = new Collection<int>();
            DeckUserPresent = 0;
        }
        
        public void ResetDeck()
        {
            
            Decks = new Collection<int>();
        }
        public string GetLevelFromOther(int index)
        {
            this.indexInt = index;
            if (this.indexInt == 1)
            {
                return "Beginner";
            }
            if (this.indexInt == 2)
            {
                return "Cowboy";
            }
            if (this.indexInt == 3)
            {
                return "Hero";
            }
            if (this.indexInt == 4)
            {
                return "Master";
            }
            if (this.indexInt == 5)
            {
                return "Expert";
            }
            if (this.indexInt == 6)
            {
                return "Genius";
            }
            return null;
        }
        public string GetLevel
        {
            get
            {
                 if (UserLevel == 1)
                {
                    return "Beginner";
                }
                if (UserLevel == 2)
                {
                    return "Cowboy";
                }
                if (UserLevel == 3)
                {
                    return "Hero";
                }
                if (UserLevel == 4)
                {
                    return "Master";
                }
                if (UserLevel == 5)
                {
                    return "Expert";
                }
                if (UserLevel == 6)
                {
                    return "Genius";
                }
                return null;
            }
        }
       public int GetUserLevelFromOther(string index)
        {
            this.indexString = index;
            if (String.Compare(this.indexString, "Beginner",StringComparison.Ordinal) == 0)
            {
                return 1;
            }
            if (String.Compare(this.indexString, "Cowboy", StringComparison.Ordinal) == 0)
            {
                return 2;
            }
            if (String.Compare(this.indexString, "Hero", StringComparison.Ordinal) == 0)
            {
                return 3;
            }
            if (String.Compare(this.indexString, "Master", StringComparison.Ordinal) == 0)
            {
                return 4;
            }
            if (String.Compare(this.indexString, "Expert", StringComparison.Ordinal) == 0)
            {
                return 5;
            }
            if (String.Compare(this.indexString, "Genius", StringComparison.Ordinal) == 0)
            {
                return 6;
            }
            return -1;
        }
    
            
    }
    
    
}
